package com.itheima.web;

import com.itheima.bean.Orders;
import com.itheima.common.R;
import com.itheima.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrdersService ordersService;

    @PostMapping("/order/submit")
    public R submit(@RequestBody Orders orders){
        int row = ordersService.submitOrder(orders);

        if(row >0){
            return R.success("添加订单成功！");
        }
        return R.error("添加订单失败！");

    }
}
